
#!/bin/bash

MODULE='percpu'

MODULE_STATUS=`lsmod | grep ${MODULE}`
[ "${MODULE_STATUS}" != "" ] && sudo rmmod ${MODULE}


echo nop > /sys/kernel/debug/tracing/trace
echo function > /sys/kernel/debug/tracing/current_tracer
echo pcpu_alloc > /sys/kernel/debug/tracing/set_ftrace_filter

sudo insmod ${MODULE}.ko

echo 1 > /sys/kernel/debug/tracing/tracing_on
sleep 5
echo 0 > /sys/kernel/debug/tracing/tracing_on

rmmod ${MODULE}
cat /sys/kernel/debug/tracing/trace


